package com.soft.zosagent.pojo;


import com.soft.zosagent.common.Constant;

import java.io.Serializable;

/**
 * @description: 主机文件信息
 * @author: cinbo，chenyinbo
 * @create: 2020-12-01 14:34
 */
public class ZFileInfo extends BaseFileInfo implements Serializable {
    private String member="";
    private String dsname="";
    private int dsorg;
    private ZosFileParameter zosFileParameter = new ZosFileParameter();
    private boolean canCreateFlag = false;

    public boolean isCanCreateFlag() {
        return canCreateFlag;
    }

    public void setCanCreateFlag(boolean canCreateFlag) {
        this.canCreateFlag = canCreateFlag;
    }

    public String getMember() {
        return member;
    }

    public void setMember(String member) {
        this.member = member;
    }

    public String getDsname() {
        return dsname;
    }

    public void setDsname(String dsname) {
        this.dsname = dsname;
    }



    @Override
    public String getFileType() {
        return Constant.ZOS_FILE;
    }

    public int getRecfmBits() {
        return recfmBits;
    }

    public void setRecfmBits(int recfmBits) {
        this.recfmBits = recfmBits;
    }

    private int recfmBits;

    public ZosFileParameter getZosFileParameter() {
        return zosFileParameter;
    }

    public void setZosFileParameter(ZosFileParameter zosFileParameter) {
        this.zosFileParameter = zosFileParameter;
    }

    public int getLrecl() {
        if(zosFileParameter != null){
            return zosFileParameter.getLrecl();
        }else{
            return 0;
        }
    }

    public int getBlockSize(){
        if(zosFileParameter != null){
            return zosFileParameter.getBlksize();
        }else{
            return 0;
        }
    }

    public String getRecfm() {
        if(zosFileParameter != null){
            return zosFileParameter.getRecfm();
        }else{
            return "";
        }
    }

    public int getPrimarySpace() {
        if(zosFileParameter != null){
            return zosFileParameter.getPrimaryAlloc();
        }else{
            return 0;
        }
    }

    public int getSecondarySpace() {
        if(zosFileParameter != null){
            return zosFileParameter.getSecondaryAlloc();
        }else{
            return 0;
        }
    }

    public SpaceUnit getSpaceUnit() {
        if(zosFileParameter != null){
            return zosFileParameter.getSpaceUnit();
        }else{
            return SpaceUnit.NULL;
        }
    }

    public void setBlockSize(int blksize) {
        if(zosFileParameter != null) {
            zosFileParameter.setBlksize(blksize);
        }
    }

    public void setLrecl(int lrecl) {
        if(zosFileParameter != null) {
            zosFileParameter.setLrecl(lrecl);
        }
    }

    public void setRecfm(String recfm) {
        if(zosFileParameter != null) {
            zosFileParameter.setRecfm(recfm);
        }
    }

    public void setDsorg(int dsorg) {
        this.dsorg = dsorg;
    }

    public CharSequence getVolume() {
        if(zosFileParameter != null){
            return zosFileParameter.getVolume();
        }else{
            return "";
        }
    }
}
